﻿using TianYuan.Core.Domain.Uow.Interception;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace TianYuan.Core.Domain.Uow.Interception
{
   public class AttributeHelper
    {
        public static NoUnitOfWorkAttribute GetNoUnitOfWorkAttributeOrNull(MemberInfo methodInfo)
        {
            var attrs = methodInfo.GetCustomAttributes(typeof(NoUnitOfWorkAttribute), false);
            if (attrs.Length > 0)
            {
                return (NoUnitOfWorkAttribute)attrs[0];
            }
            return null;
        }
        public static DisableFiltersAttribute GetDisableFiltersAttributeOrNull(MemberInfo methodInfo)
        {
            var attrs = methodInfo.GetCustomAttributes(typeof(DisableFiltersAttribute), false);
            if (attrs.Length > 0)
            {
                return (DisableFiltersAttribute)attrs[0];
            }
            return null;
        }
    }
}
